'''
@Company: TWL
@Author: xue jian
@Email: xuejian@kanzhun.com
@Date: 2020-04-01 15:15:03
'''
import random, os

def cut_data(num, path, dates, write_path):
    for date in dates:
        print(date)
        if not os.path.exists(write_path + date):
            os.mkdir(write_path + date)
        cut_files = []
        for i in range(num):
            cut_files.append(open(write_path + date + "/" + str(i), 'wb'))
        f = open(path + date, 'rb')
        count = 0
        for line in f:
            tmp_num = count//10000 % num
            cut_files[tmp_num].write(line)
            count += 1

dates = ["2019-11-06"]
# dates = ["2019-09-" + str(i) for i in range(20, 31)]
# dates.extend(["2019-10-0" + str(i) for i in range(8, 10)])
# dates.extend(["2019-10-" + str(i) for i in range(10, 31)])
# dates.extend(["2019-11-0" + str(i) for i in range(1, 5)])
print(dates)
cut_data(12, "/data2/training_data/recall_fid_data/", dates, "/data2/training_data/recall_fid_cut/")